<template>
  <div class="page-box  display-flex czbj">
    <p class="title-label mb10">
      病例集管理
    </p>

    <div class="vertical-center pt50" v-if="publisher">
      <iframe class="dsfsdxzcrtrt"
        :src="'https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/case/%E5%85%88%E5%BB%BAE%E5%AD%A6/index.html#/pages/myCaseBook/newCase?publisher=' + publisher+'&id='+idfs+'&v=5'"></iframe>

    </div>
    <div v-else>
      <n-form ref="formRef" :model="form" :rules="rules" label-width="120" :inline="false" size="normal" label-placement="left"
        class="mt20 sdfsdtrrter">
        <div class="kxzcrfecer">
          <n-grid :cols="24" :x-gap="20" :y-gap="20">
            <n-form-item-gi span="24" label="发布人:" path="fbr">
              <n-select size="medium" :options="jmdfs" clearable v-model:value="form.fbr"/>
            </n-form-item-gi>
            <n-form-item-gi span="24" label="&nbsp;">
              <n-button type="primary" size="medium" @click="tijiaofrom">确认</n-button>
              <n-button size="medium" @click="callBack" class="ml20">关闭返回</n-button>
            </n-form-item-gi>
          </n-grid>
        </div>
      </n-form>
    </div>
    <!-- <p class="title-label mb10">
      病例集管理 
    </p> -->

    <!-- v-model:value="tabName" -->
    <!-- <n-tabs type="line" size="medium">
      <n-tab-pane name="1" tab="基本信息 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="2" tab="术前信息 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="3" tab="术中信息 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="4" tab="术后随访 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="5" tab="手术体会 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="6" tab="专家简介 ">
        Part1.
      </n-tab-pane>
      <n-tab-pane name="7" tab="专家简介 ">
        Part1.
      </n-tab-pane>
    </n-tabs> -->


  </div>
</template>
<script lang='ts' setup>
import { ref } from "vue";
import { dxget, callBack,qurl } from "../../../util/index";
const usertr = ref()
const publisher = ref()
const jmdfs = ref([])
const formRef = ref()
const cz = qurl()
const idfs = ref('')
const form = ref({
  fbr: "",// 姓名
})
const rules = ref({
  fbr: [
    {
      required: true,
      message: "请选择发布人",
    },
  ],
})


const kkmxcdsf = async () => {
  const { data }: any = await dxget("xjyx/userList?page=1&pageSize=999")
  console.log(data);
  data.data.map(a => {
    jmdfs.value.push({
      label: a.name,
      value: a.id
    })
  })


}
kkmxcdsf()


const tijiaofrom = async () => {
  formRef.value?.validate(async (errors) => {
    publisher.value = form.value.fbr
  })
}

const initData = async()=>{
  const {data}:any = await dxget("xjyx/pc/caseManagement",{id:cz.id})
  console.log(data);
  publisher.value  = data.publisher
  idfs.value = data.id
}

if(cz.id){
  initData()
}


</script>
<style scoped>
.dsfsdxzcrtrt {
  border: 0;
  height: 800px;
  width: 420px;
}

.kxzcrfecer {
  width: 800px;
}
</style>
